package com.csw.android.ffmpegtest.ui.section5

import android.os.Bundle
import android.view.View
import com.csw.android.ffmpegtest.R
import com.csw.android.ffmpegtest.databinding.LayoutSection501Binding
import com.csw.android.ffmpegtest.gl.SectionRenderer
import com.csw.android.ffmpegtest.ui.base.DataBindingFragment

/**
 * 网上demo
 *
 * 着色器语言
 * https://www.cnblogs.com/renhui/p/8126121.html
 * 可以安装插件GLSL Support支持glsl着色器代码编辑
 *
 * 在线编辑网站
 * https://www.techbrood.com/tool?p=glsleditor
 */
class Section502 : DataBindingFragment<LayoutSection501Binding>() {

    override fun getContentViewID(): Int {
        return R.layout.layout_section_501
    }

    override fun initView(rootView: View, savedInstanceState: Bundle?) {
        super.initView(rootView, savedInstanceState)
        dataBinding?.glSurfaceView?.run {
            setEGLContextClientVersion(3)
            setRenderer(SectionRenderer(502))
        }
    }

    override fun onResume() {
        super.onResume()
        dataBinding?.glSurfaceView?.onResume()
    }

    override fun onPause() {
        super.onPause()
        dataBinding?.glSurfaceView?.onPause()
    }
}